package com.tws.pctask.controller;

import com.tws.common.model.ResponseWrapper;
import com.tws.pctask.model.departmentManageModel.*;
import com.tws.pctask.model.staffManageModel.*;
import com.tws.pctask.service.DepartmentManageService;
import com.tws.pctask.service.StaffManageService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

/**
 * @Description： 员工管理控制层
 * @Author: wbf
 * @Date: 2022/1/26 21:47
 */
@CrossOrigin
@RestController
@RequestMapping("systemFunction/basicSetting/staffManage")
public class StaffManageController {
    @Autowired
    private StaffManageService staffManageService;
    /**
     * 6.1获取员工列表
     * @param param 参数类
     * @return 员工列表
     */
    @GetMapping("getStaffList")
    public ResponseWrapper getStaffList(@Validated GetStaffListParam param){
        return staffManageService.getStaffList(param);
    }

    /**
     * 6.2新增或修改员工
     * @param param 修改参数
     * @return 是否成功
     */
    @PostMapping("addOrUpdateStaff")
    public ResponseWrapper addOrUpdateStaff(@Validated AddOrUpdateStaffParam param){
        return staffManageService.addOrUpdateStaff(param);
    }

    /**
     * 6.3检查员工姓名是否重复
     * @param param 员工名称
     * @return 是否重复
     */
    @GetMapping("checkStaffName")
    public ResponseWrapper checkStaffName(CheckStaffNameParam param){
        return staffManageService.checkStaffName(param);
    }

    /**
     * 6.4获取员工信息
     * @param param 员工id
     * @return 员工信息
     */
    @GetMapping("getStaffInfo")
    public ResponseWrapper getStaffInfo(GetStaffInfoParam param){
        return staffManageService.getStaffInfo(param);
    }

    /**
     * 6.5删除员工
     * @param param 员工id
     * @return 删除结果
     */
    @PostMapping("delStaff")
    public ResponseWrapper delStaff(@Validated DelStaffParam param){
        return staffManageService.delStaff(param);
    }
}
